import React from 'react';
import {
  connect
} from 'react-redux';
import {
  getQrCode
} from '../../redux/login.redux'

@connect(
  state => state.hitTheList, {
    getQrCode
  }
)
class Poster extends React.Component {
  componentDidMount() {
    this.props.getQrCode(this.props.user)
  }

  render() {
    const openid = this.props.user.openid
    return (
      <div className="poster">
        <img
          className="img"
          src={`http://59.110.166.140/vote/code?openid=${openid}`}
          alt=""
        />
      </div>
    )
  }
}

export default Poster